/*
========================================================================
 Name        : DrmAudioPlayerAppUi.cpp
 Author      : 
 Copyright   : Your copyright notice
 Description : 
========================================================================
*/

#include <eikmenub.h>
#include <akncontext.h>
#include <akntitle.h>
#include <DrmAudioPlayer.rsg>

#include "DrmAudioPlayerAppUi.h"
#include "DrmAudioPlayer.hrh"
#include "DrmAudioPlayerContainerView.h"

/**
 * Construct the CDrmAudioPlayerAppUi instance
 */ 
CDrmAudioPlayerAppUi::CDrmAudioPlayerAppUi()
	{
	}

/** 
 * The appui's destructor removes the container from the control
 * stack and destroys it.
 */
CDrmAudioPlayerAppUi::~CDrmAudioPlayerAppUi()
	{
	}

void CDrmAudioPlayerAppUi::InitializeContainersL()
	{
	iDrmAudioPlayerContainerView = CDrmAudioPlayerContainerView::NewL();
	AddViewL( iDrmAudioPlayerContainerView );
	SetDefaultViewL( *iDrmAudioPlayerContainerView );
	}

/**
 * Handle a command for this appui (override)
 * @param aCommand command id to be handled
 */
void CDrmAudioPlayerAppUi::HandleCommandL( TInt aCommand )
	{
	TBool commandHandled = EFalse;
	switch ( aCommand )
		{
		case EAknSoftkeyExit:
		case EEikCmdExit:
		    {
		    Exit();
		    }
		default:
			break;
		}
	}

/** 
 * Override of the HandleResourceChangeL virtual function
 */
void CDrmAudioPlayerAppUi::HandleResourceChangeL( TInt aType )
	{
	CAknViewAppUi::HandleResourceChangeL( aType );
	}
				
/** 
 * Override of the HandleKeyEventL virtual function
 * @return EKeyWasConsumed if event was handled, EKeyWasNotConsumed if not
 * @param aKeyEvent 
 * @param aType 
 */
TKeyResponse CDrmAudioPlayerAppUi::HandleKeyEventL(
		const TKeyEvent& /*aKeyEvent*/,
		TEventCode /*aType*/ )
	{
	// The inherited HandleKeyEventL is private and cannot be called
	return EKeyWasNotConsumed;
	}

/** 
 * Override of the HandleViewDeactivation virtual function
 *
 * @param aViewIdToBeDeactivated 
 * @param aNewlyActivatedViewId 
 */
void CDrmAudioPlayerAppUi::HandleViewDeactivation( 
		const TVwsViewId& aViewIdToBeDeactivated, 
		const TVwsViewId& aNewlyActivatedViewId )
	{
	CAknViewAppUi::HandleViewDeactivation( 
			aViewIdToBeDeactivated, 
			aNewlyActivatedViewId );
	}

/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CDrmAudioPlayerAppUi::ConstructL()
	{
	BaseConstructL( EAknEnableSkin  | EAknEnableMSK ); 
	InitializeContainersL();
	}

